package com.example.demo.firemain.data;

import lombok.Data;

/**
 * 系统时间
 * 上传建筑熊芳设施系统时间
 *
 * @author TDS
 * @date 2022/08/23
 */
@Data
public class SystemTime {
    /**
     * 系统类型
     */
    private Integer systemType;
    /**
     * 报警主机主机号  等于 系统地址
     */
    private Integer fireMainCode;
    /**
     * 发生时间
     */
    private String upTime;

    public SystemTime(String data){

        systemType = Integer.parseInt(data.substring(4,6),16);
        fireMainCode = Integer.parseInt(data.substring(6,8),16);

        String time=data.substring(8);
        String ms=String.valueOf(Integer.parseInt(time.substring(0,2),16));
        String min=String.valueOf(Integer.parseInt(time.substring(2,4),16));
        String hour=String.valueOf(Integer.parseInt(time.substring(4,6),16));
        String day=String.valueOf(Integer.parseInt(time.substring(6,8),16));
        String month=String.valueOf(Integer.parseInt(time.substring(8,10),16));
        String year=String.valueOf(Integer.parseInt(time.substring(10),16));

        upTime = "20"+year+"-"+month+"-"+day+" "+hour+":"+min+":"+ms;

    }
}
